﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Description;
using System.ServiceModel;
using NotificationServer.ServiceLayer.Contracts;
using NotificationServer.BusinessLayer;


namespace NotificationServer.ServiceLayer.Services
{
   // [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public partial class Service : INotification
    {
        private NotificationBO _notificationBO;

        
        public string Test()
        {            
            return "Test erfolgreich";
        }

        public void SendNotification(Guid deviceId, string notification)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("The notification: {0} \nsent to the following Device: {1}", notification, deviceId.ToString());
            _notificationBO = new NotificationBO();

            bool success = _notificationBO.SendNotification(deviceId, notification);

            ITest test = OperationContext.Current.GetCallbackChannel<ITest>();
            test.Test();
            
        }
    }
}